<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('clues', function (Blueprint $table) {
            $table->id();
            $table->string('name')->comment('客户姓名')->nullable();
            $table->string('phone')->comment("客户电话")->index();
            $table->integer('source')->comment("来源")->index();
            $table->string('url')->comment("来源链接")->nullable();
            $table->string('site_name')->comment("站点名称")->nullable();
            $table->string('ad_name')->comment("计划名称")->nullable();
            $table->string('ad_id')->comment("计划id")->nullable();
            $table->string('remark')->comment("备注")->nullable();
            $table->string('ip')->comment('ip')->nullable();
            $table->integer('type')->comment('线索类型')->nullable();
            $table->string('location')->comment("来源城市")->nullable();
            $table->json('question_data')->comment("表单问题")->nullable();
            $table->dateTime('post_date')->comment("提交时间")->nullable();
            $table->json('origin_data')->comment("原始数据")->nullable();
            $table->string('uuid')->comment('唯一id')->index()->nullable();
            $table->dateTime('dispatch_date')->comment('分配时间')->nullable();
            $table->unsignedBigInteger('rule_id')->nullable();
            $table->unsignedBigInteger('user_id')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('clues');
    }
};
